param( [switch]	$IncludeFileLength
     )

begin
{
	#$CrptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
	$CrptoProvider = New-Object "System.Security.Cryptography.SHA1CryptoServiceProvider"
}
process
{
	if ($_ -is [system.IO.FileInfo])
	{
		$fs = New-Object "system.io.FileStream" ($_.fullname, [system.io.filemode]::Open, [system.IO.FileAccess]::Read)
		$hash = [system.Convert]::ToBase64String($CrptoProvider.ComputeHash($fs))  
		$fs.Close()
		
		if ($IncludeFileLength)
		{
			$hash += "{0:d10}" -f $_.Length
		}

		Add-Member -inputObject ([PSObject]$_) note* -name Checksum -value $hash -passThru
	}
}